package com.lmscn.lms.api.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

/**
 * 文章分类
 * 
 * @author zhang.xx
 * @date 2016年11月6日14:12:44
 */
public class ArticleCategory extends Model<ArticleCategory> {

	public static final ArticleCategory dao = new ArticleCategory();

	/**
	 * 根据pid获取文章分类列表
	 * 
	 * @param pid
	 * @return
	 */
	public List<ArticleCategory> getArticleCategorysByPid(String pid) {
		String sql = "SELECT * FROM t_article_category t WHERE t.category_pid = ? ";
		return dao.find(sql, pid);
	}
	
	public ArticleCategory getArticleCategoryByName(String name) {
		String sql = "SELECT * FROM t_article_category t WHERE t.category_name = ? ";
		return dao.findFirst(sql, name);
	}

}
